﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenRasta.Web;
using uREST.Core.Extensions;
using uREST.Core.Resources;

namespace uREST.Core.Handlers
{
    public class TokenHandler : AbstractHandler
    {
        public TokenHandler(ICommunicationContext context)
            : base(context)
        { }

        [HttpOperation(ForUriName = "Token")]
        public OperationResult PostToken(Token request)
        {
            var response = new Token
            {
                Value = request.Tokenize()
            };

            return new OperationResult.Created { ResponseResource = response };
        }
    }
}
